package com.henriquevilela.drumtrainer.gui;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.border.EmptyBorder;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;

/**
 * @author Henrique de Souza Vilela
 * henrique.vilela@gmail.com
 */
public class AboutWindow extends JDialog implements HyperlinkListener {
	
	private static final long serialVersionUID = 1L;

	public AboutWindow(JFrame owner) {
		super(owner, Messages.getString("aboutTitle"), true);

		String text = "";

		text += "<h1 align='center'>" + Messages.getString("appName") + "</h1>";
		text += "<p align='center'>&copy; 2005-2009 " + "Henrique de Souza Vilela" + "</p>";
		text += "<a href='http//hvilel.com/'>hvilela.com</a>";

		JEditorPane editorPane = new JEditorPane("text/html", text);
		editorPane.setBorder(new EmptyBorder(10, 10, 10, 10));
		editorPane.setEditable(false);
		editorPane.addHyperlinkListener(this);
		add(editorPane);

		setResizable(false);

		pack();

		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation((int)(screenSize.getWidth() - getWidth()) / 2, (int)(screenSize.getHeight() - getHeight()) / 2);
	}

	/**
	 * @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent)
	 */
	public void hyperlinkUpdate(HyperlinkEvent event) {
		if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
			// TODO
		}
	}
}
